package com.example.wechat.login.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.wechat.login.entity.SpeechRecognitionHistory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

/**
 * 语音识别历史记录 Mapper 接口
 */
@Mapper
public interface SpeechRecognitionHistoryMapper extends BaseMapper<SpeechRecognitionHistory> {
    long countByOpenid(String openid);

    void deleteByCreateTimeBefore(@Param("createTime")LocalDateTime expirationDate);

    long count();

    boolean existsByAudioFilePathContaining(@Param("audioFilePath")String fileName);

    List<SpeechRecognitionHistory> findByStatusIn(@Param("statuses") List<Integer> list);

    Optional<SpeechRecognitionHistory> findById(@Param("id")Long id);

    boolean existsByOpenidAndAudioFilePathContaining(@Param("openid")String openid,@Param("audioFilePath") String name);
}